package src.java.SingleTon;

public class Singleton3 {
    //静态内部类: 线程安全
    //对静态域使用延迟初始化，src.java.SingleTon.Singleton 类被装载了，instance 不一定被初始化
    //只有通过显式调用 getInstance 方法时，才会显式装载 SingletonHolder 类，从而实例化 instance
    private static class SingletonHolder {
        private static final Singleton3 intance = new Singleton3();
    }
    private Singleton3() {}
    public static Singleton3 getInstance(){
        return SingletonHolder.intance;
    }

}
